package pri.damai.xiaowu.anydoor.netty.codec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import pri.damai.xiaowu.anydoor.business.BaseModel;
import pri.damai.xiaowu.anydoor.util.BizCodecUtils;

import java.util.List;

/**
 * 解码器
 *
 * @description
 * @author YangXinFu
 * @date 9:28 2022/7/25
 **/
public class BizModelDecoder extends ByteToMessageDecoder {
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {

        BaseModel model = BizCodecUtils.decode(byteBuf);

        list.add(model);
    }
}
